func maxProductAfterCutting(length int) int {
	if length == 2 {
		return 1
	} else if length == 3 {
		return 2
	}
	var product int = 1
	if length%3 == 0 {
		for i := 0; i < length/3; i++ {
			product *= 3
		}
	} else if length%3 == 2 {
		for i := 0; i < (length-2)/3; i++ {
			product *= 3
		}
		product *= 2
	} else if length%3 == 1 {
		for i := 0; i < (length-4)/3; i++ {
			product *= 3
		}
		product *= 4
	}
	return product
}